function Test(){
    return new Promise((resolve,rejected)=>{
        console.log("1111")
        setTimeout(()=>{
            // resolve 成功调用
            // resolve 中的值为then 回调中的参数
            resolve(2)
        },1000)
    })
}

console.log("同步执行123")
const P=new Promise((resolve,reject)=>{
    console.log("promise 构造同步:promise")
    setTimeout(()=>{
        console.log("Promise 构造setTimeout ")
        resolve(2)
    },1000)
})

setTimeout(()=>{
    console.log("外部setTimeout")
})
P.then(res=>{
    console.log(res)
})

setTimeout(()=>{
    console.log("200----1")
},200)
setTimeout(()=>{
    console.log("1000")
},1000)
setTimeout(()=>{
    console.log("500")
},500)
setTimeout(()=>{
    console.log("0")
},0)
setTimeout(()=>{
    console.log("200")
},200)
setTimeout(()=>{
    console.log("end 0")
},0)


setTimeout(()=>{
    console.log("200---2")
},200)

// 把一个常量转成promise 对象

let A=Promise.resolve(2)

A.then(res=>{
    console.log("A:",res)
})

//Promise.resolve 接受一个promise
const P=new Promise((resolve,reject)=>{
    setTimeout(()=>{
        resolve(2)
    },1000)
})
let B=Promise.resolve(P)
console.log(B)
B.then(res=>{
    console.log("B:",res)
})